import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class FileWriterDemo {
    public static void main(String[] args) throws IOException {
        //添加参数true也可以追加
        Writer fw = new FileWriter("file-io\\src\\data5.txt",true);
        //write方法可以直接写字符,编码,字符串(数组),并且可以限定范围
        fw.write(98);
        fw.write("\r\n");
        fw.write("字符串只要前三个字",0,3);
        fw.close();
    }
}
